|
|
|
|
|
|
|
In the MoveComplete event, I check to see whether the user is at the end or beginning of the file. If he or she is not at either end, I call a routine Ive named ControlsTagLoad. I pass into this routine the Recordset object that was passed into the MoveComplete event. I use this Recordset object to load the Tag properties: |
|
|
|
 |
|
|
|
|
Private Sub ControlsTagLoad(pRecordset As ADODB.Recordset)
Dim oCtrl As Control
If pRecordset.EOF Or pRecordset.BOF Then
For Each oCtrl In Me.Controls
If TypeOf oCtrl Is TextBox Then
oCtrl.Tag = ""
ElseIf TypeOf oCtrl Is CheckBox Then
oCtrl.Tag = vbUnchecked
End If
Next
Else
For Each oCtrl In Me.Controls
If TypeOf oCtrl Is TextBox Then
oCtrl.Tag = _
Field2Str(pRecordset(oCtrl.DataField).Value)
ElseIf TypeOf oCtrl Is CheckBox Then
oCtrl.Tag = _
Field2CheckBox(pRecordset(oCtrl.DataField).Value)
End If
Next
End If
End Sub |
|
|
|
|
|
|
|
|
Remember that the normal value properties (Text and Value) have not been set to the new value yet, and the Change event has not yet been fired. In this routine, I load the Tag properties of each data-bound control with the data thats about to be put into the value properties of those controls. |
|
|
|
|
|
|
|
|
Theres also a special case that needs to be taken into account. If the recordset is at EOF or BOF, the user cant access the recordset, so I need to set the Tag property to either a blank string or to the value of vbUnchecked for check boxes. If the user is not at EOF or BOF, I can loop through each of the controls in the Controls collection of the form and check for either a text box or a check box. (You may need to change this routine for each form if you have other types of bound controls on this |
|
|
|
|
|